package com.ph.util;

import java.text.DecimalFormat;
import java.text.Format;

public final class MathUtil {
	protected final static Format TWO = new DecimalFormat("0.00");
	protected final static Format THREE = new DecimalFormat("0.000");

	public static String formatDouble(double value, Format dFormat) {
		return dFormat.format((double) value);
	}

	public static void main(String[] args) {
		String cost = MathUtil.formatDouble((double)34 / 55, THREE);
		System.out.println(cost);

		Format format = new DecimalFormat("0.000");
		System.out.println(format.format((double) 34 / 55));
	}

}
